#include <iostream>
#include <iomanip>
using namespace std;


class TIME
{
    private:
        int hour,min,sec;
    public:
        TIME(){hour=0;min=0;sec=0;}
        TIME(int a){hour=a;min=0;sec=0;}
        TIME(int a,int b){hour=a;min=b;sec=0;}
        TIME(int a,int b,int c){hour=a;min=b;sec=c;}

        friend bool operator>(const TIME& x,const TIME& y)
        {return x.hour*10000+x.min*100+x.sec>y.hour*10000+y.min*100+y.sec;}
        friend bool operator<(const TIME& x,const TIME& y)
        {return x.hour*10000+x.min*100+x.sec<y.hour*10000+y.min*100+y.sec;}

        friend istream& operator>>(istream& is,TIME& t)
            {is>>t.hour;cin.get();is>>t.min;cin.get();is>>t.sec;
            return is;}
        friend ostream& operator<<(ostream& os,const TIME& t)
            {os<<setw(2)<<setfill('0')<<t.hour<<":"<<setw(2)<<setfill('0')<<t.min<<":"<<setw(2)<<setfill('0')<<t.sec;
             return os;}
};


int main()
{
    TIME a, b;
    cin >> a >> b;
    if (a > b)
    {
        cout << "Yes\n";
    }
    else
    {
        cout << "No\n";
    }
    return 0;
}